import React, { useEffect } from 'react'

import './myscss/Order_page.scss'
import { useNavigate, useSearchParams } from 'react-router-dom'
import axios from 'axios'
axios.defaults.baseURL = 'http://localhost:3000'
export default function Order_page() {
    const [list, setList] = React.useState([])
    let [search] = useSearchParams()
    let orid = search.get('id')
    const [id, setId] = React.useState(orid)
    let getId = async () => {
        let { data: { data } } = await axios.post('/get_id', { id })
        setList(data)
    }
    useEffect(() => {
        getId()
    }, [])

    let navigate = useNavigate()
    return (
        <div id='Order_page'>
            <div className='fans_length'>
                <b onClick={() => { navigate('/MinPage/Order_details') }}>&lt;</b><span>订单详情</span>
            </div>
          
                {
                    list.map(item => (
                        <div className='order_list' key={item._id}>

                            <div className="item_main" key={item._id}>
                                <h2>患者信息</h2>
                                <p>姓名:{item.name}</p>
                                <p>性别:{item.gender}</p>
                                <p>年龄:{item.age}</p>
                                <p>手机号:{item.phone}</p>
                            </div>
                            <div className="zd">
                              <div>
                              <h2>订单信息</h2>
                                <p>订单号:{item._id}</p>

                                <p>支付状态:已支付</p>
                                <p>支付金额:￥{item.age}</p>
                                <p>优惠卷:-￥10</p>
                                <p>实付金额:￥{item.age - 10}</p>

                                <p>支付方式:微信</p>

                                <p>创建时间:2024-09-04 12:05:00</p>
                                <p>支付时间:2024-09-04 12:06:00</p>
                              </div>
                            </div>
                        </div>
                    ))
                }

         
        </div>
    )
}
